import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main3 {
    private static int ret = 0;
    private static int n;
    private static int m;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        char[][] chs = new char[n][m];
        in.nextLine();
        for(int i = 0; i < n; i++) {
            chs[i] = in.nextLine().toCharArray();
        }
        findPath(chs, 0, 0, 0);
        System.out.println(ret);
    }
    private static void findPath(char[][] chs, int row, int col, int score) {
        if(row < n && col < m) {
            score += checkCharacter(chs[row][col]);
            findPath(chs, row + 1, col, score);
            findPath(chs, row, col + 1, score);
        }
        ret = Math.max(ret, score);
    }
    private static int checkCharacter(char ch) {
        if(ch == 'l') {
            return 4;
        }
        if(ch == 'o') {
            return 3;
        }
        if(ch == 'v') {
            return 2;
        }
        if(ch == 'e') {
            return 1;
        }
        return 0;
    }
}